package cn.dengta.webapp.media.entity;

import java.util.Date;

import cn.dengta.common.model.Status;
import cn.dengta.common.model.VerifyStatus;
import cn.dengta.webapp.base.entity.BizEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;

/**
 * 自定义风控拦截记录表
 *
 * @author zw
 * @since 2023-03-27
 */
@Setter
@Getter
@TableName("im_custom_risk_log")
public class CustomRiskLog extends BizEntity {

	Long userId;
	/** 支付方用户ID */
	Long payUserId;
	/** 风控类型：0=不露脸；1=性别不符；2=黑屏 BusinessTag */
	Integer type;
	/** 房间号 */
	String channelName;
	/** 审批人ID */
	Long verifyUserId;
	/** 审批时间 */
	Date verifyTime;
	transient Long agentId;

	/** 状态：-1=违规； 0=未处理；1=未违规 */

	public static CustomRiskLog init(Long userId, Long payUserId, String channelName, Integer type) {
		final CustomRiskLog log = new CustomRiskLog();
		log.userId = userId;
		log.payUserId = payUserId;
		log.channelName = channelName;
		log.type = type;
		log.initTime(new Date());
		log.init(VerifyStatus.WAIT_VERIFY.getValue(), null);
		return log;
	}

	public boolean canVerify() {
		return Status.NO.eq(status);
	}

	public static final String USER_ID = "user_id";
	public static final String PAY_USER_ID = "pay_user_id";
	public static final String TYPE = "type";
	public static final String CHANNEL_NAME = "channel_name";
	public static final String VERIFY_USER_ID = "verify_user_id";
	public static final String VERIFY_TIME = "verify_time";

}
